<%@page contentType="text/html"%>
<%@page pageEncoding="UTF-8"%>
<%@ taglib prefix="s" uri="/struts-tags" %>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <title>App List</title>
        <link rel="stylesheet" type="text/css" href="ExtJs/resources/css/ext-all.css" />
        <link rel="stylesheet" type="text/css" href="jmaki-standard.css" />
        <script type="text/javascript" src="ExtJs/adapter/ext/ext-base.js"></script>
        <script type="text/javascript" src="ExtJs/ext-all.js"></script>
        <script>
            function showUrl(value){
                return "<a href='appShow.action?id="+value+"'>编辑</a>";
            }
            Ext.onReady(function(){
                var ds = new Ext.data.Store({
                    proxy: new Ext.data.HttpProxy({url:'appList.action'}),//调用的动作
                    reader: new Ext.data.JsonReader({
                        //totalProperty: 'total',
                        root: 'apps',
                        successProperty :'success'
                    }, [
                        {name: 'id',mapping:'id',type:'string'}
                    ])
                });
                var grid = new Ext.grid.GridPanel({
                    el:"example-grid",
                    ds : ds,
                    store: ds,
                    columns: [
                        {header: "id", width: 120, dataIndex: 'id', sortable: true},
                        {header: "编辑", width: 120, dataIndex: 'id', renderer:showUrl}
                    ],
                    //renderTo:'example-grid',
                    width:240,
                    height:500
                });
                grid.render();
                ds.load({params:{start:0, limit:10}});
            });

        </script>
    </head>
    <body>
        <table align="center" width="80%">
            <tr><td align="center"><div id="example-grid"></div></td></tr>
        </table>
    </body>
</html>
